package com.todaynews.ui.smallvideo;

import android.view.View;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.todaynews.R;
import com.todaynews.frame.model.InfoResult;
import com.todaynews.frame.ui.fragment.BaseFragment;
import com.todaynews.frame.ui.views.brvah.BaseQuickAdapter;
import com.todaynews.frame.ui.views.recycleview.decoration.GridItemDecoration;
import com.todaynews.model.model.SmallVideo;
import com.todaynews.ui.smallvideo.adapter.SmallVideoListAdapter;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;

public class SmallVideoListFragment extends BaseFragment {

    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;
    private BaseQuickAdapter smallvideoAdapter;
    private List<SmallVideo> smallVideos = new ArrayList<>();
    private GridLayoutManager gridLayoutManager;

    @Override
    public boolean isImmersionBarEnabled() {
        return false;
    }

    @Override
    public int getLayoutResId() {
        return R.layout.fragment_small_video_list;
    }

    @Override
    public void bind(View view) {
        super.bind(view);
    }

    @Override
    public void init() {
        initData();
        GridItemDecoration decoration1 = new GridItemDecoration.Builder(getActivity())
                .verColor(R.color.white)
                .horColor(R.color.white)
                .verSize(5)
                .horSize(5)
                .margin(1,1)
                .isExistHead(false)
                .showHeadDivider(false)
                .showLastDivider(false)
                .build();
        gridLayoutManager = new GridLayoutManager(activity, 2);
        smallvideoAdapter = new SmallVideoListAdapter(smallVideos);
        recyclerView.setLayoutManager(gridLayoutManager);
        recyclerView.addItemDecoration(decoration1);
        recyclerView.setAdapter(smallvideoAdapter);

        smallvideoAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {


            }
        });
    }

    @Override
    public void loadData() {

    }

    @Override
    protected void onSuccess(int what, InfoResult t) {

    }

    @Override
    protected void onFail(int what, InfoResult t) {

    }

    private void initData() {
        SmallVideo smallVideo = new SmallVideo();
        smallVideo.setDesc("大兴集团开始兴建");
        smallVideo.setPlayerNums(3256);
        smallVideo.setPraiseNums(25684);
        smallVideo.setPath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1568960007769&di=0b462f5f4a686d8290aab22d49d6cfaf&imgtype=0&src=http%3A%2F%2Fupload.365jilin.com%2Fuploads%2Fallimg%2F130214%2F592-1302140KI7.jpg");
        smallVideo.setPlayerUrl("http://v3-default.ixigua.com/1e864633eed93bad7b5c720b493fd501/5d833484/video/m/2206ba97fa17b5744db82f7e1ff1721938911637e3e2000008a6ffc96897/?a=2012&br=719&cr=0&cs=0&dr=0&ds=2&er=&l=201909191455250100140470332E22844C&lr=&rc=amp1OWllam02bzMzOmQzM0ApZTw6ZWQzOjxmN2Q5NTw5NWcxaGVvZWsvbnFfLS02Li9zczA1NjA1XzAuYzEuMi40LTU6Yw%3D%3D");

        SmallVideo smallVideo1 = new SmallVideo();
        smallVideo1.setDesc("小新的快乐生活");
        smallVideo1.setPlayerNums(256);
        smallVideo1.setPraiseNums(2564);
        smallVideo1.setPath("http://img1.cache.netease.com/catchpic/A/A0/A09D124157DCF0E3E98CBFE00AA531F5.jpg");
        smallVideo1.setPlayerUrl("http://v3-default.ixigua.com/96a5b56379b0ff80dc59832679529fb6/5d833230/video/m/22042e2e0a924e94ce9bfa0e1d98c181851115fa6ef00005ab9cdc894d4/?a=2012&br=268&cr=0&cs=0&dr=0&ds=1&er=&l=201909191444590100140400830CC52C83&lr=&rc=anFqO3g1OTVoaTMzODczM0ApNjtpODw2Zzs1N2UzM2VpZGcwbC9mbmdvamxfLS1fLS9zcy5hYjYwLi1jYzEzMGFeNTY6Yw%3D%3D");


        SmallVideo smallVideo2 = new SmallVideo();
        smallVideo2.setDesc("青蛙开始玉带大家肯定会");
        smallVideo2.setPlayerNums(556);
        smallVideo2.setPraiseNums(2584);
        smallVideo2.setPath("http://5b0988e595225.cdn.sohucs.com/q_70,c_zoom,w_640/images/20180113/e47a7e997ffb40d9a0255a548ecc9e32.jpeg");
        smallVideo2.setPlayerUrl("http://v3-default.ixigua.com/96a5b56379b0ff80dc59832679529fb6/5d833230/video/m/22042e2e0a924e94ce9bfa0e1d98c181851115fa6ef00005ab9cdc894d4/?a=2012&br=268&cr=0&cs=0&dr=0&ds=1&er=&l=201909191444590100140400830CC52C83&lr=&rc=anFqO3g1OTVoaTMzODczM0ApNjtpODw2Zzs1N2UzM2VpZGcwbC9mbmdvamxfLS1fLS9zcy5hYjYwLi1jYzEzMGFeNTY6Yw%3D%3D");


        SmallVideo smallVideo3 = new SmallVideo();
        smallVideo3.setDesc("不知道什么大家肯定会就");
        smallVideo3.setPlayerNums(7256);
        smallVideo3.setPraiseNums(7684);
        smallVideo3.setPath("https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2388087887,3140974756&fm=26&gp=0.jpg");
        smallVideo3.setPlayerUrl("http://v3-default.ixigua.com/96a5b56379b0ff80dc59832679529fb6/5d833230/video/m/22042e2e0a924e94ce9bfa0e1d98c181851115fa6ef00005ab9cdc894d4/?a=2012&br=268&cr=0&cs=0&dr=0&ds=1&er=&l=201909191444590100140400830CC52C83&lr=&rc=anFqO3g1OTVoaTMzODczM0ApNjtpODw2Zzs1N2UzM2VpZGcwbC9mbmdvamxfLS1fLS9zcy5hYjYwLi1jYzEzMGFeNTY6Yw%3D%3D");


        SmallVideo smallVideo4 = new SmallVideo();
        smallVideo4.setDesc("从现在开店家的跨境电商");
        smallVideo4.setPlayerNums(7256);
        smallVideo4.setPraiseNums(25684);
        smallVideo4.setPath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1568964906851&di=00dad27b3acc42c547cddaf32b6dfc9c&imgtype=0&src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fphotoblog%2F1209%2F16%2Fc4%2F13889471_13889471_1347783052140.jpg");
        smallVideo4.setPlayerUrl("http://v3-default.ixigua.com/96a5b56379b0ff80dc59832679529fb6/5d833230/video/m/22042e2e0a924e94ce9bfa0e1d98c181851115fa6ef00005ab9cdc894d4/?a=2012&br=268&cr=0&cs=0&dr=0&ds=1&er=&l=201909191444590100140400830CC52C83&lr=&rc=anFqO3g1OTVoaTMzODczM0ApNjtpODw2Zzs1N2UzM2VpZGcwbC9mbmdvamxfLS1fLS9zcy5hYjYwLi1jYzEzMGFeNTY6Yw%3D%3D");


        SmallVideo smallVideo5 = new SmallVideo();
        smallVideo5.setDesc("回到家爱好打电话时");
        smallVideo5.setPlayerNums(56);
        smallVideo5.setPraiseNums(25684);
        smallVideo5.setPath("http://photocdn.sohu.com/20151025/mp37659617_1445739327988_1_th.jpeg");
        smallVideo5.setPlayerUrl("http://v3-default.ixigua.com/96a5b56379b0ff80dc59832679529fb6/5d833230/video/m/22042e2e0a924e94ce9bfa0e1d98c181851115fa6ef00005ab9cdc894d4/?a=2012&br=268&cr=0&cs=0&dr=0&ds=1&er=&l=201909191444590100140400830CC52C83&lr=&rc=anFqO3g1OTVoaTMzODczM0ApNjtpODw2Zzs1N2UzM2VpZGcwbC9mbmdvamxfLS1fLS9zcy5hYjYwLi1jYzEzMGFeNTY6Yw%3D%3D");


        SmallVideo smallVideo6 = new SmallVideo();
        smallVideo6.setDesc("的房价的看法大家");
        smallVideo6.setPlayerNums(9256);
        smallVideo6.setPraiseNums(684);
        smallVideo6.setPath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1568964906844&di=ea7a0e8e424079fa0aa736f38f4af3a1&imgtype=0&src=http%3A%2F%2Fjsxww.zjol.com.cn%2Fpic%2F0%2F11%2F40%2F28%2F11402853_877213.jpg");
        smallVideo6.setPlayerUrl("http://v3-default.ixigua.com/96a5b56379b0ff80dc59832679529fb6/5d833230/video/m/22042e2e0a924e94ce9bfa0e1d98c181851115fa6ef00005ab9cdc894d4/?a=2012&br=268&cr=0&cs=0&dr=0&ds=1&er=&l=201909191444590100140400830CC52C83&lr=&rc=anFqO3g1OTVoaTMzODczM0ApNjtpODw2Zzs1N2UzM2VpZGcwbC9mbmdvamxfLS1fLS9zcy5hYjYwLi1jYzEzMGFeNTY6Yw%3D%3D");

        smallVideos.add(smallVideo);
        smallVideos.add(smallVideo1);
        smallVideos.add(smallVideo2);
        smallVideos.add(smallVideo3);
        smallVideos.add(smallVideo4);
        smallVideos.add(smallVideo5);
        smallVideos.add(smallVideo6);
    }
}
